//
//  SettingViewController.swift
//  yaokongqi
//
//  Created by HappyMilk 02 on 2017/9/27.
//  Copyright © 2017年 nike. All rights reserved.
//

import UIKit

class SettingViewController: UIViewController {

    
    
    @IBOutlet weak var switch_set: UISwitch!
    
    
    
    
    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
        let open = UserDefaults.standard.object(forKey: "open") as? String
        if open == "1" {
            switch_set.isOn = true
        }else{
            switch_set.isOn = false
        }
        
    }
    
    @IBAction func popvc(_ sender: Any) {
        self.navigationController?.popViewController(animated: true)
    }
    
    @IBAction func switchAction(_ sender: UISwitch) {
        
        if sender.isOn {
            UserDefaults.standard.set("1", forKey: "open")
        }else{
            UserDefaults.standard.set("0", forKey: "open")
        }
    }
    

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
